<html>
<head>
</head>
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<base href="<?php echo base_url() ?>" />
<SCRIPT src="js/jquery.min.js" type="text/javascript"></SCRIPT>
<script type="text/javascript" src="js/dialog/dialog.js"></script>
<SCRIPT type="text/javascript">
function getSubStr(str1,string1,str2){
  if( ( pos = string1.indexOf(str1) ) != -1 ){ //取str1的位置
      if(str2=="left"){
         return  string1.substr(0,pos);//获取左边的字符
      }
      if(str2=="right"){
         return  string1.substr(pos+1,string1.length);//获取左边的字符
      }
  }
}
function setSend(inpt){
   var f_va=window.opener.$('#'+inpt).val(); //父窗口中inpt的值
   var s_vl="";//未添加的值
   var s_vl1=""; //己添加的值
   var isadd=false; //此值父窗口中重复过吗？
   var isnull=false;//列表为空吗？
   //处理org3的值
   $('option:selected', '#org3_name').each(function(){
        $name=getSubStr('|',this.value,'left');
       if(f_va.indexOf($name)==-1){
          s_vl+=$name;    //未添加的值
          isnull=true;
       }else{
         s_vl1+=$name;     //己添加的值
           isadd=true;
           isnull=true;
       }
     });//处理完成
      window.opener.$('#'+inpt).val(f_va+ s_vl) ;
     if(isnull){
      if(isadd){
         $('#msgs').html("<img src=\"images/check_error.gif\" /><span class=\"about_content_title\"> "+s_vl1+"己经添加过！</span>");
      }else{
         $('#msgs').html("<img src=\"images/ok.gif\" /><span class=\"about_content_title\">"+s_vl+"添加成功！</span>");
        }
      }else{
         $('#msgs').html("&nbsp;");
         new dialog().event('请在列表框中任选一项！',1,1,1,'',210,100);
      }
}
function telSend(){
   inpt='linkman';
   var f_va=window.opener.$('#'+inpt).val(); //父窗口中inpt的值
   var s_vl="";//未添加的值
   var s_vl1=""; //己添加的值
   var isadd=false; //此值父窗口中重复过吗？
   var isnull=false;//列表为空吗？
   //处理org3的值
   $('option:selected', '#org3_name').each(function(){
        $name=getSubStr('|',this.value,'right');
       if(f_va.indexOf($name)==-1){
          s_vl+=$name;    //未添加的值
          isnull=true;
       }else{
         s_vl1+=$name;     //己添加的值
           isadd=true;
           isnull=true;
       }
     });//处理完成
      window.opener.$('#'+inpt).val(f_va+ s_vl) ;
}
<!--
$(function(){
   $("#org1_name").change(function(){
      $("#org2_name").html("");
      var data_url= '<?php echo site_url("main/findOrg2") ?>'+"/"+ $("#org1_name").val();
      $("#org2_name").load(data_url); //Ajax提交
      //对于IE要重新设置临时文件的更新方式，以适应这种Ajax方式
   });
    //更新三级组织列表
   $("#org2_name").change(function(){
      $("#org3_name").html("");
      var data_url= '<?php echo site_url("main/findOrg3") ?>'+"/"+ $("#org2_name").val();
      $("#org3_name").load(data_url); //Ajax提交
      //对于IE要重新设置临时文件的更新方式，以适应这种Ajax方式
   });
      $("#org1_name").change();
 });//ready over.
-->
</SCRIPT>
<title>网页对话框--<? echo $title;?></title>
<style>
button{font-size:10pt;}select{font-size:10pt;}td{font-size:10pt;}
</style>
</head>
<body>
<form name="RYform">
	<center>
	<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2">
 	<tr>
   	<td width="29%">　</td>
    <td width="20%">
     <b>请选择一级机构：</b>
	</td>
	<td width="1%">　</td>
	<td width="21%">
	<b>请选择二级机构</b>
	</td>
	<td width="39%">　</td>
	</tr>
  	<tr>
	<td width="29%">　</td>
	<td width="20%">
  <select name="org1_name" id="org1_name"  style="width:156;font-size:13;">
   <option value="NULL" >[-请选择-]</option>
   <?php
    if(isset($org1)&&isset($userinfo)) {
     foreach ($org1->result() as $row) {
        if(trim($userinfo["org1_id"])==$row->org1_id) {
          echo" <option selected value='$row->org1_id'>"."[ ++ ]". "$row->org1_name</option>";
        }else{
          echo" <option value='$row->org1_id'>"."[ ++ ]". "$row->org1_name</option>";
          }
        }
      }
    ?>
    </select>
	</td>
	<td width="1%">　</td>
	<td width="21%">
    <select name="org2_name"  id="org2_name"  style="width:166;font-size:13;">
       <option value='NULL' selected>[-请选择任一项-]</option>
    </select>
	</td>
	<td width="39%">　</td>
	</tr>
	<tr>
	<td width="29%">　</td>
	<td width="41%" colspan="3">
<select name="org3_name" id="org3_name"  multiple size="9" style="width:330;font-size:13">
</select>
	</td>
	<td width="39%">　</td>
	</tr>
	<tr>
	<td width="29%">　</td>
	<td width="41%" colspan="3" align=left valign=center>
     <div id="msgs" style="margin-top:5px;margin-bottom:5px;font-size:13px;color: #C62E25;font-weight:bold;">&nbsp;</div>
	</td>
	<td width="39%">　</td>
	</tr>
	<tr>
	<td width="29%">　</td>
	<td width="41%" colspan="3">
	</td>
	<td width="39%">　</td>
	</tr>
	<tr>
	<td width="29%">　</td>
	<td width="100%" colspan="3">
    <input type="hidden" value="" id="email" name="email">
    <input type="hidden" value="" id="tel" name="tel">
    <input type="button" style="width:58" value="主送:" name="OK" onclick="setSend('send');telSend();">
    <input type="button" style="width:58" value="主调：" name="CT" onclick="setSend('mainsend');telSend();window.opener.$('#mainsend').change();">
    <input type="button" style="width:58" value="抄送：" name="CT" onclick="setSend('to1');telSend();">
    <input type="button" style="width:58" value="抄报：" name="BCT" onclick="setSend('to2');telSend();">
    <input type="button" style="width:70;font-weight:bold" value="  退出  " name="Cancle" onclick="window.close();">
	</td>
	<td width="0%">　</td>
	</tr>
	<tr>
	<td width="29%">　</td>
	<td width="41%" colspan="3">　</td>
	<td width="39%">　</td>
	</tr>
	</table>
	</center>
</form>
<script type="text/javascript">new dialog().init();</script>
</body>
</html>
